package org.trialiet.notedemo.http;

import java.lang.reflect.ParameterizedType;

/**
 * Created by Trialiet on 2016/5/11.
 */
public abstract class ObjectCallback<T> {
    public abstract void onSuccess(T object);
    public abstract void onFailure(int errorCode, String errorString);
    private final Class<T> clazz;

    public ObjectCallback(){
        ParameterizedType type =(ParameterizedType) this.getClass().getGenericSuperclass();
        clazz = (Class<T>) type.getActualTypeArguments()[0];
    }

    public Class<T> getDataClass(){
        return clazz;
    }
}
